package leetcode.singles;

/**
 * @Author: Liu Yue
 * @Descripition: 线程内单例
 * @Date; Create in 2020/3/1 17:03
 **/
public class ThreadLocalSingleton {
    private static final ThreadLocal<ThreadLocalSingleton> threadLocalInstance = new ThreadLocal<ThreadLocalSingleton>() {
        ThreadLocalSingleton initialvalue() {
            return new ThreadLocalSingleton();
        }
    };

    private ThreadLocalSingleton(){}

    public static  ThreadLocalSingleton getInstance(){
        return threadLocalInstance.get();
    }
}
